<script>
import form from '@/components/FreeForm/minix/form'
import { getBusinessEnumList } from '@/api/business/business'
export default {
  name: 'FormBase',
  mixins: [form],
  data() {
    return {
      businessEnum: []
    }
  },
  mounted() {
    this.getBusinessEnum()
  },
  methods: {
    getBusinessEnum() {
      getBusinessEnumList().then(resp => {
        const { data } = resp
        this.businessEnum = data
      })
    }
  }
}
</script>

<template>
  <el-form :model="formConfig" size="small" label-width="80px" label-position="left">
    <el-form-item label="表单名称" prop="name">
      <el-input v-model="formConfig.name" @blur="() => dynamicOnlineSave()" />
    </el-form-item>
    <el-form-item label="表单编码" prop="code">
      <el-input v-model="formConfig.code" @blur="() => dynamicOnlineSave()" />
    </el-form-item>
    <el-form-item label="表单尺寸" prop="size">
      <el-select v-model="formConfig.size" style="width: 100%" placeholder="请选择表单尺寸" @change="() => dynamicOnlineSave()">
        <el-option label="超小" value="mini" />
        <el-option label="小型" value="small" />
        <el-option label="中型" value="medium" />
        <el-option label="默认" value="default" />
      </el-select>
    </el-form-item>
    <el-form-item label="对齐方式" prop="labelPosition">
      <el-select v-model="formConfig.labelPosition" style="width: 100%" placeholder="请选择表单布局" @change="() => dynamicOnlineSave()">
        <el-option label="左对齐" value="left" />
        <el-option label="右对齐" value="right" />
      </el-select>
    </el-form-item>
    <el-form-item label="表单布局" prop="layout">
      <el-select v-model="formConfig.layout" style="width: 100%" placeholder="请选择表单布局" @change="() => dynamicOnlineSave()">
        <el-option label="卡片" value="card" />
        <el-option label="折叠面板" value="collapse" />
        <el-option label="时间线" value="timeline" />
      </el-select>
    </el-form-item>
    <el-form-item label="标签宽度" prop="labelWidth">
      <el-input v-model="formConfig.labelWidth" @blur="() => dynamicOnlineSave()" />
    </el-form-item>
    <el-form-item label="表单类型" prop="type">
      <el-input v-model="formConfig.type" @blur="() => dynamicOnlineSave()" />
    </el-form-item>
    <el-form-item label="业务类型" prop="labelWidth">
      <el-select v-model="formConfig.businessType" @change="() => dynamicOnlineSave()">
        <el-option v-for="item in businessEnum" :key="item.type" :label="item.desc" :value="item.type" />
      </el-select>
    </el-form-item>
    <el-form-item label="是否禁用" prop="disabled">
      <el-switch v-model="formConfig.disabled" @change="() => dynamicOnlineSave()" />
    </el-form-item>
  </el-form>
</template>

<style scoped lang="scss">

</style>
